use android_activity::input::Keycode as Android;
use ruffle_core::events::KeyCode as Ruffle;

pub fn android_keycode_to_ruffle(android: Android) -> Option<(Ruffle, Option<char>)> {
    Some(match android {
        Android::DpadUp => (Ruffle::UP, None),
        Android::DpadDown => (Ruffle::DOWN, None),
        Android::DpadLeft => (Ruffle::LEFT, None),
        Android::DpadRight => (Ruffle::RIGHT, None),
        Android::Keycode0 => (Ruffle::KEY0, Some('0')),
        Android::Keycode1 => (Ruffle::KEY1, Some('1')),
        Android::Keycode2 => (Ruffle::KEY2, Some('2')),
        Android::Keycode3 => (Ruffle::KEY3, Some('3')),
        Android::Keycode4 => (Ruffle::KEY4, Some('4')),
        Android::Keycode5 => (Ruffle::KEY5, Some('5')),
        Android::Keycode6 => (Ruffle::KEY6, Some('6')),
        Android::Keycode7 => (Ruffle::KEY7, Some('7')),
        Android::Keycode8 => (Ruffle::KEY8, Some('8')),
        Android::Keycode9 => (Ruffle::KEY9, Some('9')),
        Android::A => (Ruffle::A, Some('a')),
        Android::B => (Ruffle::B, Some('b')),
        Android::C => (Ruffle::C, Some('c')),
        Android::D => (Ruffle::D, Some('d')),
        Android::E => (Ruffle::E, Some('e')),
        Android::F => (Ruffle::F, Some('f')),
        Android::G => (Ruffle::G, Some('g')),
        Android::H => (Ruffle::H, Some('h')),
        Android::I => (Ruffle::I, Some('i')),
        Android::J => (Ruffle::J, Some('j')),
        Android::K => (Ruffle::K, Some('k')),
        Android::L => (Ruffle::L, Some('l')),
        Android::M => (Ruffle::M, Some('m')),
        Android::N => (Ruffle::N, Some('n')),
        Android::O => (Ruffle::O, Some('o')),
        Android::P => (Ruffle::P, Some('p')),
        Android::Q => (Ruffle::Q, Some('q')),
        Android::R => (Ruffle::R, Some('r')),
        Android::S => (Ruffle::S, Some('s')),
        Android::T => (Ruffle::T, Some('t')),
        Android::U => (Ruffle::U, Some('u')),
        Android::V => (Ruffle::V, Some('v')),
        Android::W => (Ruffle::W, Some('w')),
        Android::X => (Ruffle::X, Some('x')),
        Android::Y => (Ruffle::Y, Some('y')),
        Android::Z => (Ruffle::Z, Some('z')),
        Android::Comma => (Ruffle::COMMA, Some(',')),
        Android::Period => (Ruffle::PERIOD, Some('.')),
        Android::AltLeft => (Ruffle::ALT, None),
        Android::AltRight => (Ruffle::ALT, None),
        Android::ShiftLeft => (Ruffle::SHIFT, None),
        Android::ShiftRight => (Ruffle::SHIFT, None),
        Android::Tab => (Ruffle::TAB, Some('\t')),
        Android::Space => (Ruffle::SPACE, Some(' ')),
        Android::Enter => (Ruffle::RETURN, Some(13 as char)),
        Android::Del => (Ruffle::BACKSPACE, Some(8 as char)),
        Android::Grave => (Ruffle::GRAVE, Some('`')),
        Android::Minus => (Ruffle::MINUS, Some('-')),
        Android::Equals => (Ruffle::EQUALS, Some('=')),
        Android::LeftBracket => (Ruffle::LBRACKET, Some('(')),
        Android::RightBracket => (Ruffle::RBRACKET, Some(')')),
        Android::Backslash => (Ruffle::BACKSLASH, Some('\\')),
        Android::Semicolon => (Ruffle::SEMICOLON, Some(';')),
        Android::Apostrophe => (Ruffle::APOSTROPHE, Some('\'')),
        Android::Slash => (Ruffle::SLASH, Some('/')),
        Android::Plus => (Ruffle::PLUS, Some('+')),
        Android::PageUp => (Ruffle::PG_UP, None),
        Android::PageDown => (Ruffle::PG_DOWN, None),
        Android::Escape => (Ruffle::ESCAPE, None),
        Android::ForwardDel => (Ruffle::DELETE, Some(127 as char)),
        Android::CtrlLeft => (Ruffle::CONTROL, None),
        Android::CtrlRight => (Ruffle::CONTROL, None),
        Android::CapsLock => (Ruffle::CAPS_LOCK, None),
        Android::ScrollLock => (Ruffle::SCROLL_LOCK, None),
        Android::Break => (Ruffle::PAUSE, None),
        Android::MoveHome => (Ruffle::HOME, None),
        Android::MoveEnd => (Ruffle::END, None),
        Android::Insert => (Ruffle::INSERT, None),
        Android::F1 => (Ruffle::F1, None),
        Android::F2 => (Ruffle::F2, None),
        Android::F3 => (Ruffle::F3, None),
        Android::F4 => (Ruffle::F4, None),
        Android::F5 => (Ruffle::F5, None),
        Android::F6 => (Ruffle::F6, None),
        Android::F7 => (Ruffle::F7, None),
        Android::F8 => (Ruffle::F8, None),
        Android::F9 => (Ruffle::F9, None),
        Android::F10 => (Ruffle::F10, None),
        Android::F11 => (Ruffle::F11, None),
        Android::F12 => (Ruffle::F12, None),
        Android::NumLock => (Ruffle::NUM_LOCK, None),
        Android::Numpad0 => (Ruffle::NUMPAD0, Some('0')),
        Android::Numpad1 => (Ruffle::NUMPAD1, Some('1')),
        Android::Numpad2 => (Ruffle::NUMPAD2, Some('2')),
        Android::Numpad3 => (Ruffle::NUMPAD3, Some('3')),
        Android::Numpad4 => (Ruffle::NUMPAD4, Some('4')),
        Android::Numpad5 => (Ruffle::NUMPAD5, Some('5')),
        Android::Numpad6 => (Ruffle::NUMPAD6, Some('6')),
        Android::Numpad7 => (Ruffle::NUMPAD7, Some('7')),
        Android::Numpad8 => (Ruffle::NUMPAD8, Some('8')),
        Android::Numpad9 => (Ruffle::NUMPAD9, Some('9')),
        Android::NumpadDivide => (Ruffle::NUMPAD_SLASH, Some('/')),
        Android::NumpadMultiply => (Ruffle::MULTIPLY, Some('*')),
        Android::NumpadSubtract => (Ruffle::NUMPAD_MINUS, Some('-')),
        Android::NumpadAdd => (Ruffle::PLUS, Some('+')),
        Android::NumpadDot => (Ruffle::NUMPAD_PERIOD, Some('.')),
        Android::NumpadComma => (Ruffle::COMMA, Some(',')),
        Android::NumpadEnter => (Ruffle::NUMPAD_ENTER, Some(13 as char)),
        Android::NumpadEquals => (Ruffle::EQUALS, Some('=')),
        _ => return None,
    })
}
